/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package test.cei.rmi.observer.cliente;

import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.Scanner;
import test.cei.rmi.observer.common.rmi.ServidorRMI;

/**
 *
 * @author Francisco
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws RemoteException, NotBoundException {
        String name = new Scanner(System.in).nextLine();
        ServidorRMI servidor;
        Registry r = LocateRegistry.getRegistry("localhost", 9999);
        servidor = (ServidorRMI) r.lookup(ServidorRMI.REBIND_NAME);
        Cliente cli = new Cliente(name);
        servidor.agregarObservador(cli);
        cli.comunicar();
    }
}
